package com.yenroc.ho.controller;

import com.yenroc.ho.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api")
public class OrderController {


    @Autowired
    private OrderService orderService;

    /**
     * 减库存
     * @return
     */
    @PostMapping("/order/add")
    public ResponseEntity<Map<String, Object>> reduceGood(@RequestBody Map<String, Object> parmas) throws Exception {
        Map<String, Object> stringObjectMap = orderService.addOrder(parmas);
        return  new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
    }
}
